﻿using PlusAssistance.DAL.Concrete;
using PlusAssistance.Domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace PlusAssistance.DAL.Abstract
{
    public interface IRepository<T> where T : BaseEntity
    {
        T GetById(int id);

        IEnumerable<T> All();

        void Add(T entity);

        void Update(T entity);

        void Delete(T entity);

        void Delete(int id);

        T Single(Expression<Func<T, bool>> predicate);

        List<T> Where(Expression<Func<T, bool>> predicate);

        bool Exists(Expression<Func<T, bool>> predicate);

        void Flush();

        PagedList<T> GetPaged<TKey>(Expression<Func<T, bool>> predicate, int pageIndex, int pageSize, List<Func<T, TKey>> orderFuncs);

        IQueryable<T> Filter(Expression<Func<T, bool>> predicate);
    }
}
